//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "player\fn_playerHasRole.sqf"
#include <tmf_constants.h>
#include <tmf_macros.h>

TRACE_1("Start",_this);
TMFPROFILERSTART;

private ["_unit","_role","_result"];
DEFAULT_PARAM(_unit,0,objNull);
DEFAULT_PARAM(_role,1,"");
_result = false;
if (isPlayer _unit) then {
	if (!isnil "mp_rights_fnc_hasRoles" && isMultiPlayer && (["MP_RIGHTS_CHECK",false] call FFUNC(getFrameworkValue))) then {
		if (IS_STRING(_role)) then { _role = [_role]; };
		if !("admin" in _role) then { _role set [count _role,"admin"]; };
		_result = [(getPlayerUID _unit),_role] call mp_rights_fnc_hasRoles;
	} else {
		_result = true;
	};
} else {
	_result = true;
	DEBUG_1("Not a player",ARR_4(_unit, str _unit, typeof _unit, side _unit));
};
TRACE_1("End",_result);
TMFPROFILERSTOP;
_result;